﻿/*
	zealotwms 仓库管理系统
	Copyright (C) 2011  狂热者工作组 
    内容：数据载入等待类
    时间: 2011-9-6
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace Zwms.Client.CommonUI
{
    public partial class WaitForm : Form
    {
        private System.Threading.Thread tWait = null;
        public WaitForm()
        {
            InitializeComponent();
            this.tWait = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(ShowWaitDialog));
            this.tWait.Name = "waiting thread";
            this.StartPosition = FormStartPosition.CenterScreen;
        }

        public void ShowWaitMessage(string message)
        {
            tWait.Start(message);
        }

        public void CloseWaitMessage()
        {
            if (this.tWait.ThreadState == System.Threading.ThreadState.Running)
            {
                this.tWait.Abort();
            }
        }

        private void ShowWaitDialog(object message)
        {
            this.lblMessage.Text = message.ToString();
            this.ShowDialog();
        }
    }
}
